package com.cn.algorithm.two.union;

public class UnionFind_QU_R_PS extends UnionFind_QU_R{

    public UnionFind_QU_R_PS(int capacity) {
        super(capacity);
    }

    @Override
    int find(int v) {
        checkIndex(v);
        while (parent[v] != v) {
            int p = parent[v];
            parent[v] = parent[p];
            v = p;
        }
        return parent[v];
    }
}
